package com.example.dormmanage.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.dormmanage.service.impl.BillsService;
import com.example.dormmanage.view.ResultView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/bills")
@Api(tags = "水电费管理")
@Slf4j
public class BillsController {

    @Autowired
    private BillsService billsService;

    @ApiOperation("查询楼宇水电费列表")
    @GetMapping()
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "buildingId", value = "楼宇id", required = true,dataTypeClass = Integer.class),
                    @ApiImplicitParam(name = "page", value = "页码", required = true,dataTypeClass = Integer.class ),
                    @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = true,dataTypeClass = Integer.class),
                    @ApiImplicitParam(name = "roomName", value = "宿舍号", required = false,dataTypeClass = String.class)
            }
    )
    private ResultView<Page> selectBillsList(Integer page, Integer pageSize, Integer buildingId, String roomName){
        return billsService.selectBillsList(page,pageSize,buildingId,roomName);
    }
}
